Health Cloud Medications System API - Implementation Template
Setup guide
Please review the pre-requisite setup instructions for setting up Salesforce Health Cloud and Salesforce Connected App.
Importing Templates into Anypoint Studio
- In Studio, click the Exchange X icon in the upper left of the taskbar.
- Log in with your Anypoint Platform credentials.
- Search for the template.
- Click Open.
Running Templates in Anypoint Studio
After you import your template into Studio, follow these configuration steps to run it:
Common Configuration
mule.env
- sets the environment where the application is to be deployed. It should be configured inconfig-<mule.env>.yaml
file. For a studio deployment, the recommended mule.env value islocal
.mule.key
- sets the encryption password to be used for encrypting secure properties. Update as needed.api.autoDiscoveryID
should be configured inconfig-<mule.env>.yaml
file.
Salesforce Connector Configuration
MuleSoft's Salesforce Connector requires username, password, and optionally a security token to communicate with Salesforce. After obtaining the necessary credentials information configure it in the properties file located in config/properties
folder.
salesforce.username
should be configured in config-<env>.yaml
file.
salesforce.password
should be encrypted and configured in config-secured-<env>.yaml
file.
salesforce.securityToken
should be encrypted and configured in config-secured-<env>.yaml
file.
Please refer to the attached link on how to secure the configuration properties.
Salesforce Composite Connector Configuration
This template uses Salesforce composite connector to perform atomic upserts to multiple Salesforce objects in a single transaction. It requires 'Connected App' in Salesforce.
Please refer to the instructions in Salesforce docs link.
After creating the connected app obtaining the necessary credentials information (Consumer Key and Consumer Secret) configure it in the properties file located in config/properties
folder.
salesforce.username
should be configured in config-<env>.yaml
file.
salesforce.password
should be encrypted and configured in config-secured-<env>.yaml
file.
salesforce.consumerKey
should be configured in config-<env>.yaml
file.
salesforce.consumerSecret
should be encrypted and configured in config-secured-<env>.yaml
file.
salesforce.securityToken
should be encrypted and configured in config-secured-<env>.yaml
file.
Please refer to the attached link on how to secure the configuration properties.
HTTPS Configuration
https.host
β sets the service host interface. It should be configured inconfig-<mule.env>.yaml
file. (Defaults to 0.0.0.0 for all interfaces).https.port
β sets the HTTPS service port number. It should be configured inconfig-<mule.env>.yaml
file. (Default 8082).https.defaultRecordLimit
: Sets the default search limit for the result set. (Default 20).- TLS Configuration - Keystore properties setup:
keystore.alias
- sets the alias to the keystore. It should be configured inconfig-<mule.env>.yaml
file.keystore.path
- sets the path to the key file. Key should be available in /src/main/resources/keystore. It should be configured inconfig-<mule.env>.yaml
file.keystore.keypass
β sets keystore keypass to support HTTPS operation. It should be encrypted and configured inconfig-secured-<mule.env>.yaml
file.keystore.password
β sets keystore password to support HTTPS operation. It should be encrypted and configured inconfig-secured-<mule.env>.yaml
file.
Please refer to the attached link on how to generate the Keystore.
Health Cloud Configuration
Extend the Health Cloud Data Model:
These instructions assume an Org was created in Salesforce and a custom object 'FHIR_CodeSet__c' is created for loading FHIR CodeableConcept codesets. The codesets are loaded for CodeableConcept FHIR fields that are mapped to picklist fields in Salesforce HealthCloud.
- Click on Salesforce Setup icon and select 'Developer Console' -> It will open a new console window
- Go to File -> New -> Apex class and create a new apex class
- Copy the code from "/src/test/scripts/MetadataUtility.apxc" to the above apex class and save
- Go to Debug -> Open Execute Anonymous Window. Execute the scripts one by one from '/src/test/scripts/CreateCustomField.txt'
- The user account being used for the application needs to be configured to use the custom fields. In Setup search for 'Profiles'. Select the profile for the user account. Next click 'Object Settings' and then select 'FHIR_CodeSet__c'. Finally scroll to 'Field Permissions' section and then ensure the fields set in the scripts have 'Read Access' and 'Edit Access' checked.
Dependency Data Setup
Follow instructions below to import data into the custom object 'FHIR_CodeSet__c' using Data Import Wizard
.
- Prepare data for import and create an import file. For more information, see the FAQ item
How do I prepare my data for import?
on the Data Import wizard welcome page. Refer FHIR defined value sets orsrc/test/import-codesets
in the project to load data for the required codesets. - From the Setup page in Salesforce Health Cloud, enter Data Import Wizard in the Quick Find box, then select
Data Import Wizard
. - Review the information provided on the welcome page, then click
Launch Wizard
. - Choose the object to import.
- Click
Custom Objects
and then select 'FHIR_CodeSet__c'. - Specify to add new records to Salesforce, update existing records, or add and update records simultaneously.
- Specify matching and other criteria as necessary.
- Specify the file that contains data by dragging the CSV to the upload area of the page or navigating to the file.
- Choose a character encoding method for the uploaded file.
- Select comma or tab as a value separator.
- Click
Next
.
- Click
- Map the data fields to Salesforce data fields. The Data Import wizard maps as many of the data fields as possible to standard Salesforce data fields. But if the wizard canβt map fields, map it manually. Unmapped fields are not imported into Salesforce.
- Scan the list of mapped data fields and locate the unmapped fields.
- Click
Map
to the left of each unmapped field. - In the Map Your Field dialog box, search and choose up to 10 Salesforce fields to map to and click
Map
. - To change mappings that Salesforce performed automatically, click
Change
to the left of the appropriate field. Delete the Salesforce fields which are not required to map, choose the fields required to map, then clickMap
. - Click
Next
.
- Review and start import.
- Review import information on the Review page. If there are unmapped fields required to import, click Previous to return to the previous page and specify the mappings.
- Click
Start Import
.
- Check import status. The
Recent Import Jobs
chart on the Data Import Wizard home page lists the status and metrics of the data import. Alternately from Setup, enter Bulk Data Load Jobs in the Quick Find box, then selectBulk Data Load Jobs
.
Run it
- Right-click the template project folder.
- Hover your mouse over Run as.
- Click Mule Application (configure).
- Inside the dialog, select Environment and set the variable mule.env to the appropriate value (e.g dev or local)
- Inside the dialog, select Environment and set the variable mule.key. Click Run.
Deployment instructions for CloudHub using provided scripts
Ensure the Maven profile CloudHub-DEV
has been properly configured in your settings.xml
file. Reference can be found by downloading the Accelerator Common Resources asset. Additional instructions are available in the Getting Started with MuleSoft Accelerators - Build Environment guide.
Update the config-dev.yaml
properties appropriately and then use one of the following scripts to deploy the application to CloudHub:
- packageDeploy.sh or deployOnly.sh (Mac/Linux)
- packageDeploy.cmd or deployOnly.cmd (Windows)
Test it
- Use Advanced Rest Client or Postman to send a request over HTTPS. The template includes a postman collection in the
src/test/resources
folder. Update the collection variable(s) after successful import.